﻿<UserControl x:Class="AvalonLibraryTest.Main"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:av="http://schemas.codeplex.com/wpfcontrib/xaml/presentation"
    xmlns:loc="clr-namespace:AvalonLibraryTest"
    Name="This">
    <FrameworkElement.Resources>
        <XmlDataProvider x:Key="Pages">
            <x:XData>
                <Pages xmlns="">
                    <Page Uri="Pages\Introduction.xaml" Title="Introduction"/>
                    <Page Uri="Pages\TaskDialogs.xaml" Title="Task Dialog"/>
                    <Page Uri="Pages\NotifyIcon.xaml" Title="Notify Icon" RequiresFullTrust="True" />
                    <Page Uri="Pages\Imaging.xaml" Title="Imaging"/>
                    <Page Uri="Pages\Panels.xaml" Title="Panels"/>
                    <Page Uri="Pages\Animation.xaml" Title="Animation"/>
                    <Page Uri="Pages\Converters.xaml" Title="Converters"/>
                    <Page Uri="Pages\Effects.xaml" Title="Effects" RequiresFullTrust="True" RequiresVersion="3.5" RequiresSp="1" />
                    <Page Uri="Pages\Text.xaml" Title="Text"/>
                    <Page Uri="Pages\AvalonStyle.xaml" Title="Avalon Theme"/>
                    <Page Uri="Pages\FolderBrowserDialog.xaml" Title="Folder Browser Dialog" RequiresFullTrust="True" />
                </Pages>
            </x:XData>
        </XmlDataProvider>
    </FrameworkElement.Resources>
    <Grid SnapsToDevicePixels="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Border BorderThickness="1,1,0,1" Margin="10,10,-10,10" CornerRadius="10,0,0,10">
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="1,0">
                    <GradientStop Color="Navy" Offset="0" />
                    <GradientStop Color="Transparent" Offset="1" />
                </LinearGradientBrush>
            </Border.BorderBrush>
            <ListView Name="PageList"
			    SelectedIndex="0" 
			    ItemsSource="{Binding Source={StaticResource Pages}, XPath=Pages/Page}"
			    VerticalAlignment="Top"
			    SelectedValuePath="@Uri"
			    Margin="10,10,20,10" BorderThickness="0" Background="Transparent">
                <ListView.View>
                    <GridView>
                        <GridView.ColumnHeaderContainerStyle>
                            <Style TargetType="FrameworkElement">
                                <Setter Property="Visibility" Value="Collapsed" />
                            </Style>
                        </GridView.ColumnHeaderContainerStyle>
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <TextBlock Text="{Binding XPath=@Title}" />
                                        <TextBlock Name="req" FontSize="8" Foreground="Gray" Visibility="Collapsed"
                                                   Text="{Binding Converter={loc:PageRequirementsConverter AsText=True}}" />
                                        </StackPanel>
                                    <DataTemplate.Triggers>
                                        <DataTrigger Binding="{Binding Converter={loc:PageRequirementsConverter}}" Value="False">
                                            <Setter TargetName="req" Property="Visibility" Value="Visible" />
                                        </DataTrigger>
                                    </DataTemplate.Triggers>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
                <ItemsControl.ItemContainerStyle>
                    <Style TargetType="ListViewItem">
                        <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content, Converter={loc:PageRequirementsConverter}}" />
                    </Style>
                </ItemsControl.ItemContainerStyle>
            </ListView>
        </Border>

        <Rectangle Name="x" Grid.Column="1" Margin="0,11,11,11" RadiusX="10" RadiusY="10" Fill="White" Stretch="Fill"
                   BitmapEffect="{av:DropShadowBitmapEffect Color=Navy, Direction=180, ShadowDepth=1}" />

        <Border Grid.Column="1" Background="White" BorderThickness="0,1,1,1" Margin="0,10,10,10" CornerRadius="0,10,10,0" Padding="10">
            <Frame Name="ContentFrame" Source="{Binding ElementName=PageList, Path=SelectedValue}" NavigationUIVisibility="Hidden" />
        </Border>

    </Grid>
</UserControl>
